<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>专题设置</title>
<meta content="" name="description">
<script type="text/javascript" src="/j-tool/jquery.js"></script>
<link href='/public/css/admins.css' rel='stylesheet' type='text/css'/>
<style>
	.bgcoloer{background:#E2EEEE;}
	#box1{border:1px solid gray;height:100px;width:960px;margin:0 auto;}
	.shape{width:960px;margin:0 auto;margin-top: 10px;}
	.iname{border:1px solid gray;height:30px;}
	.shape ul{margin-top: 5px;}
	.shape ul li{float:left;border:1px solid gray;height:25px;line-height:25px;font-size:14px;width:215px;margin: 0 11px 5px;display:inline;background:#E2EEEE;}
	.shape ul li input{float:left;height:23px;line-height:23px;width:187px;border:0;background:white;}
	.shape ul li span{float:left;width: 24px;height:25px;border-left:1px solid gray;}
	.iname span{float:right;width:33px;height:30px;border-left:1px solid gray;text-indent:-1000px;overflow:hidden;}
	.additem{float:left;border:1px solid gray;height:25px;width:215px;background:#E2EEEE;margin: 0 11px 5px;text-indent:-1000px;}
	.botbox{width:960px;margin:0 auto;margin-top: 10px;height:27px;text-align:center;}
	.iname input{height:28px;line-height:28px;width:187px;border:0;background:white;}
</style>
<body>
	<div class='bread'>专题设置</div>
	<div class="manageBox">
	<form action="" method="post">
		<div id="box1" class="bgcoloer"></div>
		<!--{foreach from=$list item=val key=key}-->
		<div class="shape">
			<div class="bgcoloer iname">
				<input type="text" name="item[<!--{$key}-->][ptitle]" value="<!--{$val.ptitle}-->">--<input type="text" name="item[<!--{$key}-->][pdesc]" value="<!--{$val.pdesc}-->">
				<span onclick="addlist(this);">增加</span>
			</div>
			<ul>
				<!--{foreach from=$val.plist item=v key=k}-->
				<li>
					<input type="text" name="item[<!--{$key}-->][plist][<!--{$k}-->][title]" value="<!--{$v.title}-->">
					<input type="text" name="item[<!--{$key}-->][plist][<!--{$k}-->][link]" value="<!--{$v.link}-->" onblur="getinfo(this);" style="display:none;">
					<span onclick="dele(this);"></span>
				</li>
				<!--{/foreach}-->
				<span onclick="additem(this);" class="additem">添加</span><br class="clear">
			</ul>			
		</div>
		<!--{/foreach}-->
		<div class="botbox"><input type="submit" value="提交" class="butt"/></div>
	</form>
	</div>
</body>
<script>
	$('.shape > ul >li').live('click',function(){
		var key = $(this).parents('.shape').index('.shape');
		var k = $(this).index();
		$(this).html()?'':$(this).append('<input type="text" name="item['+key+'][plist]['+k+'][link]" onblur="getinfo(this);"><span onclick="dele(this);"></span>');
	});
	function additem(t){$(t).before('<li></li>');}
	var html = '<div class="shape"><div class="bgcoloer iname"><span onclick="addlist(this);">增加</span></div><ul><span onclick="additem(this);" class="additem">添加</span><br class="clear"></ul></div>';
	function addlist(t){$(t).parents('.shape').after(html);}
	function dele(t){$(t).parent().empty();}
	function getinfo(t)
	{
		var key = $(t).parents('.shape').index('.shape');
		var k = $(t).parents('li').index();
		$(t).hide().before('<input type="text" name="item['+key+'][plist]['+k+'][title]" value="'+t.value+'">');
	}
</script>
</html>